/*
 * frmAccountDetail.java
 *
 * Created on April 28, 2010, 5:31 PM
 */
package GUI;

import Interact.Login;
import Validate_Connect.DataInteraction;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;

/**
 *
 * @author  Shinichi
 */
public class frmAccountDetail extends javax.swing.JDialog {

    /** Creates new form frmAccountDetail */
    public frmAccountDetail(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        try {
            initComponents();
            ResultSet rs = DataInteraction.queryResultSet("select * from tblUser where Username = '" + Login.get_Username() + "'");
            rs.next();
            _lblAccount.setText(Login.get_Username());
            if (Login.get_Role().equals("ADM")) {
                _lblAccountType.setText(Login.get_Role() + "(Administrator)");
            } else if (Login.get_Role().equals("STA")) {
                _lblAccountType.setText(Login.get_Role() + "(Staff)");
            }
            _txtFullName.setText(rs.getString("FullName"));
            _txtAddress.setText(rs.getString("Address"));
            _txtBirthday.setText(rs.getString("Birthday"));
            _txtIdentityCard.setText(rs.getString("IdentityCard"));
            _txtEmail.setText(rs.getString("Email"));
        } catch (SQLException ex) {
            Logger.getLogger(frmAccountDetail.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.setTitle("AITSM - Account Detail - " + Login.get_Username());
        getRootPane().setDefaultButton(_btnClose);
        
    }

    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        _txtFullName = new javax.swing.JTextField();
        _txtAddress = new javax.swing.JTextField();
        _txtBirthday = new javax.swing.JTextField();
        _txtEmail = new javax.swing.JTextField();
        _btnChangePass = new javax.swing.JButton();
        _btnClose = new javax.swing.JButton();
        jLabel13 = new javax.swing.JLabel();
        _lblAccount = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        _lblAccountType = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        _txtIdentityCard = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        jLabel4.setText("Address:");

        jLabel2.setText("FullName:");

        _txtFullName.setEditable(false);

        _txtAddress.setEditable(false);

        _txtBirthday.setEditable(false);

        _txtEmail.setEditable(false);

        _btnChangePass.setText("Change Password");
        _btnChangePass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _btnChangePassActionPerformed(evt);
            }
        });

        _btnClose.setText("Close");
        _btnClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _btnCloseActionPerformed(evt);
            }
        });

        jLabel13.setText("Account:");

        _lblAccount.setFont(new java.awt.Font("Tahoma", 1, 11));
        _lblAccount.setForeground(new java.awt.Color(255, 0, 0));
        _lblAccount.setText("_lblAccount");

        jLabel3.setText("Account Type:");

        _lblAccountType.setFont(new java.awt.Font("Tahoma", 1, 11));
        _lblAccountType.setForeground(new java.awt.Color(255, 0, 0));
        _lblAccountType.setText("_lblAccountType");

        jLabel5.setText("Birthday:");

        jLabel6.setText("Email:");

        jLabel7.setText("Identity Card:");

        _txtIdentityCard.setEditable(false);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24));
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/InfomationThumb.png"))); // NOI18N
        jLabel1.setText("Information");
        jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(jLabel1)
                        .add(jPanel1Layout.createSequentialGroup()
                            .addContainerGap()
                            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jPanel1Layout.createSequentialGroup()
                                    .add(172, 172, 172)
                                    .add(_btnChangePass)
                                    .add(18, 18, 18)
                                    .add(_btnClose))
                                .add(jPanel1Layout.createSequentialGroup()
                                    .add(23, 23, 23)
                                    .add(jLabel13)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                    .add(_lblAccount)
                                    .add(70, 70, 70)
                                    .add(jLabel3)
                                    .add(18, 18, 18)
                                    .add(_lblAccountType))
                                .add(jPanel1Layout.createSequentialGroup()
                                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(jLabel5)
                                        .add(jLabel6))
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(_txtEmail, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 265, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .add(jPanel1Layout.createSequentialGroup()
                                            .add(_txtBirthday, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 137, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                            .add(35, 35, 35)
                                            .add(jLabel7)
                                            .add(22, 22, 22)
                                            .add(_txtIdentityCard, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 107, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))))
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                            .addContainerGap()
                            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jLabel4)
                                .add(jLabel2))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(_txtFullName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 196, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(_txtAddress, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 370, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(10, 10, 10)
                        .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(29, 29, 29)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel13)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(_lblAccount)
                        .add(jLabel3)
                        .add(_lblAccountType)))
                .add(24, 24, 24)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(_txtFullName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel2))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel4)
                    .add(_txtAddress, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel5)
                    .add(_txtIdentityCard, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel7)
                    .add(_txtBirthday, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel6)
                    .add(_txtEmail, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(_btnClose)
                    .add(_btnChangePass))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void _btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__btnCloseActionPerformed
    this.dispose();
}//GEN-LAST:event__btnCloseActionPerformed

private void _btnChangePassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__btnChangePassActionPerformed
    frmChangePassword _frmchangepass = new frmChangePassword(null, true);
    _frmchangepass.setLocationRelativeTo(null);
    _frmchangepass.setTitle("Change Password   -   " + Login.get_Username());
    _frmchangepass.setVisible(true);
}//GEN-LAST:event__btnChangePassActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                frmAccountDetail dialog = new frmAccountDetail(new javax.swing.JFrame(), true);
//                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
//                    public void windowClosing(java.awt.event.WindowEvent e) {
//                        System.exit(0);
//                    }
//                });
//                dialog.setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton _btnChangePass;
    private javax.swing.JButton _btnClose;
    private javax.swing.JLabel _lblAccount;
    private javax.swing.JLabel _lblAccountType;
    private javax.swing.JTextField _txtAddress;
    private javax.swing.JTextField _txtBirthday;
    private javax.swing.JTextField _txtEmail;
    private javax.swing.JTextField _txtFullName;
    private javax.swing.JTextField _txtIdentityCard;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    // End of variables declaration//GEN-END:variables
}
